#include <QString>
#include <elfstructs.h>

// 符号类型解析
QString SymbolEntry::typeString() const {
    switch (ELF32_ST_TYPE(info)) {
    case STT_NOTYPE:  return "NOTYPE";
    case STT_OBJECT:  return "OBJECT";
    case STT_FUNC:    return "FUNCTION";
    case STT_SECTION: return "SECTION";
    case STT_FILE:    return "FILE";
    default:          return QString("UNKNOWN (%1)").arg(ELF32_ST_TYPE(info));
    }
}

// 符号绑定属性解析
QString SymbolEntry::bindString() const {
    switch (ELF32_ST_BIND(info)) {
    case STB_LOCAL:  return "LOCAL";
    case STB_GLOBAL: return "GLOBAL";
    case STB_WEAK:   return "WEAK";
    default:        return QString("UNKNOWN (%1)").arg(ELF32_ST_BIND(info));
    }
}

// 符号可见性解析
QString SymbolEntry::visibilityString() const {
    switch (ELF32_ST_VISIBILITY(other)) {
    case STV_DEFAULT:   return "DEFAULT";
    case STV_INTERNAL: return "INTERNAL";
    case STV_HIDDEN:    return "HIDDEN";
    case STV_PROTECTED:return "PROTECTED";
    default:           return QString("UNKNOWN (%1)").arg(other);
    }
}
